﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMS.MODEL;

namespace SMS.DAL.CustomClasses
{
  public   class DALMainMenu
    {

      public List<MainMenu> getMainMenu()
      {
          SMSRepository<MainMenu> smsRepository = new SMSRepository<MainMenu>();

          var   mainmenus = smsRepository.Fetch().ToList();
          
          List<MainMenu> menus = new List<MainMenu>();

          foreach (var mainMenu in mainmenus)
          {
              
              MainMenu menu = new MainMenu();
              menu.MenuID = mainMenu.MenuID;
              menu.name = mainMenu.name;

              menu.IconPath = mainMenu.IconPath;
              foreach (var submenu in mainMenu.SubMenus.ToList() )
              {

                  menu.SubMenus.Add(submenu);

              }
               
              menus.Add(menu);
          }
          return menus ;
      }
    }
}
